package com.zcr.vo;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @version 1.0
 * @author： 张诚
 * @date： 2021-01-22 15:38
 */
@Data
@Slf4j
public class Result {
    private int code=0;
    private int count;
    private String msg;
    private Object data;

    public static Result sucess(Object data){
        Result result = new Result();
        result.setCode(0);
        result.setData(data);
        return result;
    }

    public static Result success(String msg){
        Result result = new Result();
        result.setCode(1);
        result.setMsg(msg);
        return result;
    }

    public static Result fail(String msg,Exception e){
        Result result = new Result();
        result.setCode(-1);
        result.setMsg(msg);
        log.error(msg,e);
        return result;
    }

}
